<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.welfare.admin.system.*" %>
<%
	HashList code001		= CommonUtil.getCodeList("001");	//권한

	String s_auth_code		= StringUtil.nvl(request.getParameter("s_auth_code"));
	String s_dept_name		= StringUtil.nvl(request.getParameter("s_dept_name"));


	HashMap infos = new HashMap();
	infos.put("auth_code",  s_auth_code);
	infos.put("dept_name",	s_dept_name);

	SystemDAO dao 	= new SystemDAO();
	HashList list 	= dao.selectDeptAuthList(infos);
 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#s_dept_name').focus().select();
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
			.click(function(){
				//none
			});
		$('#list').find('input, select').change(function() {
			$(this).closest('tr').find('input[name="list.job_type"]').val('U');
		});
	});


	function fnSave() {
		$("#saveForm").attr('action', './deptAuthSave.do');
		$("#saveForm").submit();
	}


	</script>
</head>
<body>
<div id="wrap">
	<div id="page">
		<div id="contents">
			<div class="menu_title">
				<h1>부서권한관리</h1>
				<p>관리자 > 시스템관리 > <b>부서권한관리</b></p>
			</div>
			<div class="clear line_01"></div>

			<form id="searchForm" method="post" action="./deptAuthList.jsp">
			<table cellpadding="0" cellspacing="0" class="table_01 mt15">
			<colgroup>
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col  />
			</colgroup>
			<tr>
				<th><p>권한</p></th>
				<td>
					<select name="s_auth_code" class="w120">
						<option value="">전체</option>
						<%= StringUtil.makeOption(code001, s_auth_code) %>
					</select>
				</td>
				<th><p>부서명</p></th>
				<td class="brx">
					<input type="text" name="s_dept_name" id="s_dept_name" value="<%= s_dept_name %>" class="w120"/>
				</td>
			</tr>
			</table>

			<div class="mt10 mb10 r">
				<input type="image" class="button" src="../images/btn_search.gif"/>
				<a href="#nohref" onclick="fnSave()"><img src="../images/btn_save.gif"/></a>
			</div>

			</form>



			<div class="search_result">검색결과 : <%= list.size() %>건</div>

			<form id="saveForm" method="post" action="./deptAuthSave.do">
			<input type="hidden" name="s_auth_code" value="<%=s_auth_code %>" />
			<input type="hidden" name="s_dept_name" value="<%=s_dept_name %>" />
		    <table cellpadding="0" cellspacing="0" class="table_03">
				<colgroup>
					<col width="100px"/>
					<col />
					<col width="200px"/>
					<col width="100px"/>
					<col width="160px"/>
				</colgroup>
				<thead>
					<tr>
						<th><p>부서코드</p></th>
						<th><p>부서명</p></th>
						<th><p>권한</p></th> 
						<th><p>변경일</p></th>
						<th><p>변경자</p></th>
					</tr>
				</thead>
				<tbody id="list">
			<%	for (int i = 0; i < list.size(); i++) { %>
					<tr>
						<td>
							<%= list.get("dept_code", i) %>
							<input type="hidden" name="list.job_type" value="X" class="w20" />
							<input type="hidden" name="list.dept_code" value="<%= list.get("dept_code", i) %>"  />
						</td>
						<td class="l"><%= list.get("dept_name", i) %></td>
						<td>
							<select name="list.auth_code" class="w120">
							<option value=""></option>
							<%= StringUtil.makeOption(code001, list.get("auth_code", i)) %>
						  	</select>
						</td>
						<td><%= list.get("mod_date", i) %></td>
						<td><%= list.get("mod_user", i) %></td>
					</tr>
			<%	} %>
				</tbody>
			</table>
			
			</form>
		</div>
	</div>
</div>
</body>
</html>
